package com.pn.taikao.mapper;

import com.pn.taikao.entity.StudentCourse;
import com.pn.taikao.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface StudentCourseMapper {
    int insert(StudentCourse studentCourse);

    int deleteById(@Param("id") Long id);

    int deleteByStudentIdAndCourseId(@Param("studentId") Long studentId, @Param("courseId") Long courseId);

    StudentCourse selectById(@Param("id") Long id);

    StudentCourse selectByStudentIdAndCourseId(@Param("studentId") Long studentId, @Param("courseId") Long courseId);

    List<StudentCourse> selectByStudentId(@Param("studentId") Long studentId);

    List<StudentCourse> selectByCourseId(@Param("courseId") Long courseId);

    long countByStudentId(@Param("studentId") Long studentId);

    long countByCourseId(@Param("courseId") Long courseId);
    
    /**
     * 查询选择某课程的学生列表（关联用户表）
     */
    List<User> selectStudentsByCourseId(@Param("courseId") Long courseId);
}

